package o;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.Context;
import android.os.Debug.MemoryInfo;
import com.tencent.mm.opensdk.constants.ConstantsAPI.AppSupportContentFlag;
import java.util.List;

public class eqa {

    public interface a {
        void ˊ(b bVar);
    }

    public static class b {
        private long ˋ;
        private String ˎ;
        private long ˏ;

        public void ˎ(String str) {
            this.ˎ = str;
        }

        public void ॱ(long j) {
            this.ˋ = j;
        }

        public long ˋ() {
            return this.ˏ;
        }

        public void ˏ(long j) {
            this.ˏ = j;
        }

        public long ˎ() {
            return ˋ() / AppSupportContentFlag.MMAPP_SUPPORT_XLS;
        }
    }

    public static b ˊ(String str, Context context) {
        ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
        List<RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
        if (CollectCheck.isEmpty((List) runningAppProcesses)) {
            return null;
        }
        for (RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
            String str2 = runningAppProcessInfo.processName;
            if (str.equals(str2)) {
                b bVar = new b();
                bVar.ˎ(str2);
                MemoryInfo[] processMemoryInfo = activityManager.getProcessMemoryInfo(new int[]{runningAppProcessInfo.pid});
                if (epz.ॱ(processMemoryInfo)) {
                    return null;
                }
                bVar.ˏ((long) processMemoryInfo[0].getTotalPrivateDirty());
                bVar.ॱ((long) processMemoryInfo[0].getTotalPss());
                return bVar;
            }
        }
        return null;
    }

    public static void ˊ(final Context context, final a aVar) {
        dmq.ˏ.ˊ(dmp.CONCURRENT, new dmi() {
            public void run() {
                ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
                ActivityManager.getMyMemoryState(new RunningAppProcessInfo());
                MemoryInfo[] processMemoryInfo = activityManager.getProcessMemoryInfo(new int[]{r1.pid});
                if (!epz.ॱ(processMemoryInfo) && aVar != null) {
                    final b bVar = new b();
                    bVar.ˏ((long) processMemoryInfo[0].getTotalPrivateDirty());
                    bVar.ॱ((long) processMemoryInfo[0].getTotalPss());
                    dmq.ॱ.ˊ(new dmi(this) {
                        final /* synthetic */ AnonymousClass4 ˏ;

                        public void run() {
                            aVar.ˊ(bVar);
                        }
                    });
                }
            }
        });
    }
}
